//8 7
//1 1 3 3 4 4 5 9
//1
//10
//50
//14
//15
//22
//30

#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long n; cin>>n;
  long long q; cin>>q;
  vector<long long> arr;
  for(int i=0;i<n;++i)
  {
    long long a; cin>>a;
    arr.push_back(a);
  }
  sort(arr.begin(),arr.end());
  for(int i=0;i<q;++i)
  {
    long long sum=0;
    long long ans=0;
    long long x; cin>>x;
    for(int i=0;i<n;++i)
    {
      sum+=arr[i];
      cout<<"sum="<<sum<<" ";
      ans++;
      if(sum>=x)
      {
         cout<<ans<<"\n";
         break;
      }
    }
    if(sum<x)
      cout<<-1<<"\n";
  }
  return 0;
}
